package com.creating.mict.action;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import com.creating.mict.service.IColumnService;
import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class ColumnAction extends ActionSupport {

	@Resource
	private IColumnService columnService;
	
	//获取报表或图表树
	public String findColumnTree() {
		HttpServletRequest request = ServletActionContext.getRequest();
		//或当前登录用户名
		String loginName = (String)request.getSession().getAttribute("loginName");
		String str = columnService.buildColumnTree(loginName, node);
		request.setAttribute("result", str);
		return "success";
	}
	
	
	//获取所有栏目树
	public String getAllColumnTree() {
		HttpServletRequest request = ServletActionContext.getRequest();
		//或当前登录用户名
		String loginName = (String)request.getSession().getAttribute("loginName");
		String str = columnService.buildCheckColumnTreeByUserRole(node, fcode);//buildCheckReportTree(node);
		request.setAttribute("result", str);
		return "success";
	}
	
	

	/**
	 * 
	* @Title: buildCheckBoxTree 
	* @Description: TODO(这里用一句话描述这个方法的作用) 
	* @param @return 
	* @return String    返回类型 
	* @throws
	 */
	public String buildCheckBoxTree() {
		HttpServletRequest request = ServletActionContext.getRequest();
		//或当前登录用户名
		String loginName = (String)request.getSession().getAttribute("loginName");
		String str = columnService.buildCheckBoxTree(loginName, node, fflag);
		request.setAttribute("result", str);
		return "success";
	}
	
	
	
	
	private String query;
	
	//树节点id
	private String node;
	
	private int limit = 50; //分页结束
	private int start = 0;  //分页起始
	private int total;		//总页数
	
	private String fbh;
	private String fname;
	private String fleaf;
	private String fparent;
	private String fdesc;
	private String fflag;
	private String ftype;

	private String fcode; //角色id


	public String getQuery() {
		return query;
	}


	public void setQuery(String query) {
		this.query = query;
	}


	public String getNode() {
		return node;
	}


	public void setNode(String node) {
		this.node = node;
	}


	public int getLimit() {
		return limit;
	}


	public void setLimit(int limit) {
		this.limit = limit;
	}


	public int getStart() {
		return start;
	}


	public void setStart(int start) {
		this.start = start;
	}


	public int getTotal() {
		return total;
	}


	public void setTotal(int total) {
		this.total = total;
	}


	public String getFbh() {
		return fbh;
	}


	public void setFbh(String fbh) {
		this.fbh = fbh;
	}


	public String getFname() {
		return fname;
	}


	public void setFname(String fname) {
		this.fname = fname;
	}


	public String getFleaf() {
		return fleaf;
	}


	public void setFleaf(String fleaf) {
		this.fleaf = fleaf;
	}


	public String getFparent() {
		return fparent;
	}


	public void setFparent(String fparent) {
		this.fparent = fparent;
	}


	public String getFdesc() {
		return fdesc;
	}


	public void setFdesc(String fdesc) {
		this.fdesc = fdesc;
	}


	public String getFflag() {
		return fflag;
	}


	public void setFflag(String fflag) {
		this.fflag = fflag;
	}


	public String getFtype() {
		return ftype;
	}


	public void setFtype(String ftype) {
		this.ftype = ftype;
	}


	public String getFcode() {
		return fcode;
	}


	public void setFcode(String fcode) {
		this.fcode = fcode;
	}
	
	
}
